/*		passwd.c - Password reading/hashing routines
		Implemented in Microsoft C.
		Routines for getting a pass phrase from the user's console.

		(c) Copyright 1990-1996 by Philip Zimmermann.  All rights reserved.
		The author assumes no liability for damages resulting from the use
		of this software, even if the damage results from defects in this
		software.  No warranty is expressed or implied.

		Note that while most PGP source modules bear Philip Zimmermann's
		copyright notice, many of them have been revised or entirely written
		by contributors who frequently failed to put their names in their
		code.  Code that has been incorporated into PGP from other authors
		was either originally published in the public domain or is used with
		permission from the various authors.

		PGP is available for free to the public under certain restrictions.
		See the PGP User's Guide (included in the release package) for
		important information about licensing, patent restrictions on
		certain algorithms, trademarks, copyrights, and export controls.
*/

#include "pgp.h"
#include "md5.h"

/*
**		hashpass - Hash pass phrase down to 128 bits (16 bytes).
**	keylen must be less than 1024.
**		Use the MD5 algorithm.
*/
void hashpass (char *keystring, int keylen, byte *hash)
{
		struct MD5Context mdContext;

		/* Calculate the hash */
		MD5Init(&mdContext);
		MD5Update(&mdContext, (unsigned char *) keystring, keylen);
		MD5Final(hash, &mdContext);
} /* hashpass */
